| Conditions | 4 |
| Paths | 4 |
| Total Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | $(function () { |
||
| 2 | if (!$('body.articleinfo').length) { |
||
| 3 | return; |
||
| 4 | } |
||
| 5 | |||
| 6 | var setupToggleTable = function () { |
||
| 7 | window.setupToggleTable( |
||
| 8 | window.textshares, |
||
| 9 | window.textsharesChart, |
||
| 10 | 'percentage', |
||
| 11 | $.noop |
||
| 12 | ); |
||
| 13 | }; |
||
| 14 | |||
| 15 | var $textsharesContainer = $('.textshares-container'); |
||
| 16 | |||
| 17 | if ($textsharesContainer[0]) { |
||
| 18 | /** global: xtBaseUrl */ |
||
| 19 | var url = xtBaseUrl + 'articleinfo-authorship/' |
||
| 20 | + $textsharesContainer.data('project') + '/' |
||
| 21 | + $textsharesContainer.data('article') + '?htmlonly=yes'; |
||
| 22 | |||
| 23 | $.ajax({ |
||
| 24 | url: url, |
||
| 25 | timeout: 30000 |
||
| 26 | }).done(function (data) { |
||
| 27 | $textsharesContainer.replaceWith(data); |
||
| 28 | setupTocListeners(); |
||
| 29 | setupColumnSorting(); |
||
| 30 | setupToggleTable(); |
||
| 31 | }).fail(function (_xhr, _status, message) { |
||
| 32 | $textsharesContainer.replaceWith( |
||
| 33 | $.i18n('api-error', 'Authorship API: <code>' + message + '</code>') |
||
| 34 | ); |
||
| 35 | }); |
||
| 36 | } else if ($('.textshares-table').length) { |
||
| 37 | setupToggleTable(); |
||
| 38 | } |
||
| 39 | }); |
||
| 40 |